package com.hellobike.haxing.modules.product.entity;

import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.hellobike.haxing.modules.product.mapper.typehandler.JSONObjectHandler;
import lombok.Data;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * @Description: 拼团商品
 * @Author: haxing-boot
 * @Date: 2020-01-29
 * @Version: V1.0
 */
@Data
@TableName(value = "t_promotion_group", autoResultMap = true)
public class PromotionGroup implements Serializable {
    private static final long serialVersionUID = 1L;

    /**
     * id
     */
    @TableId(type = IdType.AUTO)
    private Long id;
    /**
     * 活动主表id
     */
    @Excel(name = "活动主表id", width = 15)
    private Long promotionId;
    /**
     * 商品id
     */
    @Excel(name = "商品id", width = 15)
    private Long productId;
    /**
     * 成团人数
     */
    @Excel(name = "成团人数", width = 15)
    private Integer size;
    /**
     * 自动成团：0-否 1-是
     */
    @Excel(name = "自动成团：0-否 1-是", width = 15)
    private Integer autoComplete;
    /**
     * 开团有效期规则
     */
    @Excel(name = "开团有效期规则", width = 15)
    @TableField(typeHandler = JSONObjectHandler.class)
    private JSONObject timeLimitRule;
    /**
     * 排序
     */
    @Excel(name = "排序", width = 15)
    private Integer sortIndex;
    /**
     * 状态：0-下架 1-上架
     */
    @Excel(name = "状态：0-下架 1-上架", width = 15)
    private Integer status;
    /**
     * 创建时间
     */
    @Excel(name = "创建时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;
    /**
     * 修改时间
     */
    @Excel(name = "修改时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date updateTime;
    /**
     * 创建人
     */
    @Excel(name = "创建人", width = 15)
    private Integer createBy;
    /**
     * 修改人
     */
    @Excel(name = "修改人", width = 15)
    private Integer updateBy;
    /**
     * 是否删除：0-否 1-是
     */
    @Excel(name = "是否删除：0-否 1-是", width = 15)
    @TableLogic
    private Integer deleted;


    /**
     * 拼团sku列表
     */
    @TableField(exist = false)
    private List<PromotionGroupSku> groupSkus;

    /**
     * 商品名称
     */
    @TableField(exist = false)
    private String productName;
    /**
     * 商品编码
     */
    @TableField(exist = false)
    private String spuCode;


    private Integer groupType;
}
